import Vue from 'vue'
import VueRouter from 'vue-router'

//一级路由
import Register from '@/views/Register'
import Login from '@/views/Login'
import Layout from '@/views/Layout'

//二级路由
import Article from '@/views/second/article'
import Collect from '@/views/second/collect'
import News from '@/views/second/news'
import User from '@/views/second/user'

//切换路由
import ListCity from '@/views/ListCity'
import MyCollect from '@/views/MyCollect'
import MyRent from '@/views/MyRent'
import GoRent from '@/views/GoRent'
import comm from '@/views/comm'
import HouseDeyail from '@/components/HouseDeyail'
import mapRent from '@/views/mapRent'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    component: Layout,
    redirect: '/article',
    children: [
      {
        path: '/article',
        component: Article,
      },
      {
        path: '/collect',
        component: Collect
      },
      {
        path: '/news',
        component: News
      },
      {
        path: '/user',
        component: User,
      },
    ]
  },
  {
    path: '/register',
    component: Register
  },
  {
    path: '/login',
    component: Login
  },
  {
    path: '/mycollect',
    component: MyCollect
  },
  {
    path: '/myrent',
    component: MyRent
  },
  {
    path: '/listcity',
    component: ListCity
  },
  {
    path: '/gorent',
    component: GoRent
  },
  {
    path: '/comm',
    component: comm
  },
  {
    path: '/housedeyail',
    component: HouseDeyail
  },
  {
    path: '/maprent',
    component: mapRent
  }
]

const router = new VueRouter({
  routes
})

export default router
